<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="stylesheet" href="../../assets/css/layui.css">
    <link rel="stylesheet" href="../../assets/css/view.css"/>
    <title></title>
</head>
<body class="layui-view-body">
    <div class="layui-content">
        <div class="layui-row">
            <div class="layui-card">
                <div class="layui-card-header">录入病人信息</div>
                <form id="form" class="layui-form layui-card-body" >
                  <div class="layui-form-item">
                    <label class="layui-form-label">问诊号</label>
                    <div class="layui-input-block">
                      <input type="text" name="code" required  lay-verify="required" placeholder="请输入问诊号" autocomplete="off" class="layui-input">
                    </div>
                  </div>
                  <div class="layui-form-item">
                    <label class="layui-form-label">病人所属地</label>
                    <div class="layui-input-block">
                    </div>
                  </div>
                    <select name="company" lay-verify="" lay-search>
                        <option >中国内陆</option><option >台湾</option><option >国际友人</option>
                    </select>

                    <div class="layui-form-item">
                    <label class="layui-form-label">病人姓名</label>
                    <div class="layui-input-block">
                      <input type="text" name="username" required  lay-verify="required" placeholder="请输入病人姓名" autocomplete="off" class="layui-input">
                    </div>
                  </div>
                  <div class="layui-form-item">
                    <label class="layui-form-label">手机号码</label>
                    <div class="layui-input-block">
                      <input type="text" name="phonenumber" required  lay-verify="required" placeholder="请输入手机号码" autocomplete="off" class="layui-input">
                    </div>
                  </div>
                  <div class="layui-form-item">
                    <div class="layui-input-block">
                      <button class="layui-btn layui-btn-blue" lay-submit lay-filter="formDemo">立即提交</button>
                      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                  </div>
                </form>  
            </div>
        </div>
    </div>
    <script src="../../assets/layui.all.js"></script>
    <script src="/qrcode/jquery2.1.4.js"></script>
    <script src="/layer/layer.js"></script>
        <script>
            $(function () {
                $("#form").submit(function () {
                    var windowId=layer.load(1);



                    var number=$("input:eq(0)").val();
                    var company=$("input:eq(1)").val();
                    var username=$("input:eq(2)").val();
                    var userPhone=$("input:eq(3)").val();



                    $.post("/express/insert.do",{
                        number:number,
                        company:company,
                        username:username,
                        userPhone:userPhone

                    },function (data) {

                        if(data.status==0){

                            layer.close(windowId);
                            layer.msg("录入成功");

                            $("input:eq(0)").val("");
                            $("input:eq(1)").val("中国内陆");
                            $("input:eq(2)").val("");
                            $("input:eq(3)").val("");

                        }else if(data.status!=0){
                            layer.msg(data.result);
                        }

                    },"json")

                });
            })
        </script>
</body>
</html>